package com.yupi.project.util;

import java.util.Random;

public class VerificationCodeGeneratorUtil {

    public static String generateVerificationCode() {
        // 定义验证码的字符集
        String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuilder code = new StringBuilder();
        Random random = new Random();
        
        // 生成4位验证码
        for (int i = 0; i < 4; i++) {
            int index = random.nextInt(chars.length());
            code.append(chars.charAt(index));
        }
        
        return code.toString();
    }
}